﻿Public Class frmPrintParamater
    Public value As Integer
    Public defaultValue As Integer
    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Public Sub New(ByVal strTen1 As String, ByVal value1 As Integer, ByVal strTen2 As String, ByVal value2 As Integer)
        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        defaultValue = value1
        lblTen1.Text = strTen1 + " " + CStr(value1)
        lblTen2.Text = strTen2
        txtValue2.Text = value2
    End Sub

    Private Sub btnChon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChon.Click
        Try
            value = CInt(txtValue2.Text)
            If value < 0 Then
                ShowMessages("Giá trị không hợp lệ.")
                Exit Sub
            End If
        Catch ex As Exception
            value = defaultValue
        End Try
        Me.Close()
    End Sub
End Class